mysql> select * from stu;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 |
+----+--------+-----+-----------+-----------+-------------+------+
5 rows in set (0.00 sec)

mysql> select * from stu;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 |
+----+--------+-----+-----------+-----------+-------------+------+
5 rows in set (0.00 sec)

mysql> select name from stu;
+--------+
| name   |
+--------+
| 何子健 |
| 何子健 |
| 邓声明 |
| 黄镇江 |
| 郑晓晓 |
+--------+
5 rows in set (0.00 sec)

mysql> select name stu_name,sex stu_sex from stu;
+----------+---------+
| stu_name | stu_sex |
+----------+---------+
| 何子健   | 男      |
| 何子健   | 男      |
| 邓声明   | 男      |
| 黄镇江   | 男      |
| 郑晓晓   | 女      |
+----------+---------+
5 rows in set (0.00 sec)

mysql> select name as stu_name,sex as stu_sex from stu;
+----------+---------+
| stu_name | stu_sex |
+----------+---------+
| 何子健   | 男      |
| 何子健   | 男      |
| 邓声明   | 男      |
| 黄镇江   | 男      |
| 郑晓晓   | 女      |
+----------+---------+
5 rows in set (0.00 sec)

mysql> select * from stu;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 |
+----+--------+-----+-----------+-----------+-------------+------+
5 rows in set (0.00 sec)

mysql> select * from stu where name='何子健';
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
+----+--------+-----+-----------+-----------+-------------+------+
2 rows in set (0.08 sec)

mysql> select * from stu where sex='男';
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
+----+--------+-----+-----------+-----------+-------------+------+
4 rows in set (0.00 sec)

mysql> select * from stu where age < 16;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
+----+--------+-----+-----------+-----------+-------------+------+
1 row in set (0.00 sec)

mysql> select * from stu where age>15 and age<25;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
+----+--------+-----+-----------+-----------+-------------+------+
1 row in set (0.00 sec)

mysql> select * from stu where age>=15 and age<25;
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
+----+--------+-----+-----------+-----------+-------------+------+
2 rows in set (0.00 sec)

mysql> select * from stu where name='何子健' or name = '邓声明';
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
+----+--------+-----+-----------+-----------+-------------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where name!='何子健';
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 |
+----+--------+-----+-----------+-----------+-------------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where name<>'何子健';
+----+--------+-----+-----------+-----------+-------------+------+
| id | name   | sex | hobby     | qq        | phone       | age  |
+----+--------+-----+-----------+-----------+-------------+------+
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 |
+----+--------+-----+-----------+-----------+-------------+------+
3 rows in set (0.00 sec)

mysql> alter table stu add class varchar(10);
Query OK, 0 rows affected (0.27 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> alter table stu add num int(10);
Query OK, 0 rows affected (0.27 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> desc stu;
+-------+---------------------------+------+-----+-----------+----------------+
| Field | Type                      | Null | Key | Default   | Extra          |
+-------+---------------------------+------+-----+-----------+----------------+
| id    | int(6) unsigned           | NO   | PRI | NULL      | auto_increment |
| name  | varchar(20)               | NO   |     | XX同学    |                |
| sex   | enum('保密','女','男')    | NO   |     | 保密      |                |
| hobby | set('打架','游戏','看书') | NO   |     | 游戏,看书 |                |
| qq    | int(10) unsigned          | YES  |     | NULL      |                |
| phone | varchar(11)               | YES  |     | NULL      |                |
| age   | int(3)                    | YES  |     | NULL      |                |
| class | varchar(10)               | YES  |     | NULL      |                |
| num   | int(10)                   | YES  |     | NULL      |                |
+-------+---------------------------+------+-----+-----------+----------------+
9 rows in set (0.02 sec)

mysql> desc stu;
+-------+---------------------------+------+-----+-----------+----------------+
| Field | Type                      | Null | Key | Default   | Extra          |
+-------+---------------------------+------+-----+-----------+----------------+
| id    | int(6) unsigned           | NO   | PRI | NULL      | auto_increment |
| name  | varchar(20)               | NO   |     | XX同学    |                |
| sex   | enum('保密','女','男')    | NO   |     | 保密      |                |
| hobby | set('打架','游戏','看书') | NO   |     | 游戏,看书 |                |
| qq    | int(10) unsigned          | YES  |     | NULL      |                |
| phone | varchar(11)               | YES  |     | NULL      |                |
| age   | int(3)                    | YES  |     | NULL      |                |
| class | varchar(10)               | YES  |     | NULL      |                |
| num   | int(10)                   | YES  |     | NULL      |                |
+-------+---------------------------+------+-----+-----------+----------------+
9 rows in set (0.00 sec)

mysql> select * from stu;
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby     | qq        | phone       | age  | class | num  |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 游戏,看书 | 110112114 | 1892
514234 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 游戏,看书 | 110112114 | 1892
514234 |   30 | P2016 |    3 |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
5 rows in set (0.00 sec)

mysql> select class,num from stu;
+-------+------+
| class | num  |
+-------+------+
| P2016 |    1 |
| P2016 |    2 |
| P2015 |    1 |
| P2015 |    2 |
| P2016 |    3 |
+-------+------+
5 rows in set (0.00 sec)

mysql> select concat(class,num) as class_num from stu;
+-----------+
| class_num |
+-----------+
| P20161    |
| P20162    |
| P20151    |
| P20152    |
| P20163    |
+-----------+
5 rows in set (0.08 sec)

mysql> select name,age as class_num from stu;
+--------+-----------+
| name   | class_num |
+--------+-----------+
| 何子健 |      NULL |
| 何子健 |        20 |
| 邓声明 |        15 |
| 黄镇江 |        25 |
| 郑晓晓 |        30 |
+--------+-----------+
5 rows in set (0.00 sec)

mysql> select name,age,age>15 as class_num from stu;
+--------+------+-----------+
| name   | age  | class_num |
+--------+------+-----------+
| 何子健 | NULL |      NULL |
| 何子健 |   20 |         1 |
| 邓声明 |   15 |         0 |
| 黄镇江 |   25 |         1 |
| 郑晓晓 |   30 |         1 |
+--------+------+-----------+
5 rows in set (0.00 sec)

mysql> select distinct name from stu;
+--------+
| name   |
+--------+
| 何子健 |
| 邓声明 |
| 黄镇江 |
| 郑晓晓 |
+--------+
4 rows in set (0.00 sec)



mysql> select * from stu where hobby='看书';
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  5 | 郑晓晓 | 女  | 看书  | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where find_in_set('看书',hobby);
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby $4;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '$4' at line 1
mysql> select * from stu where hobby &4;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.06 sec)

mysql> select * from stu where hobby &1;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
2 rows in set (0.00 sec)

mysql> select * from stu where hobby &2;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby &3;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.01 sec)

mysql> select * from stu where hobby &4;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.02 sec)

mysql> select * from stu where hobby &5;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select * from stu where hobby &6;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select * from stu where hobby &7;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
5 rows in set (0.00 sec)

mysql> select * from stu where hobby &1;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
2 rows in set (0.00 sec)

mysql> select * from stu where hobby &2;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby &3;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select * from stu where hobby &4;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby &6;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select * from stu where hobby like '看书';
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  5 | 郑晓晓 | 女  | 看书  | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where hobby like '%看书';
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby like '%看书%';
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.01 sec)

mysql> select * from stu where hobby like '%游戏';
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  3 | 邓声明 | 男  | 游戏  | 110112114 | 18925142345 |   15 | P2015 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where hobby like '%游戏%';
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where hobby = '游戏';
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  3 | 邓声明 | 男  | 游戏  | 110112114 | 18925142345 |   15 | P2015 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where hobby = '游戏,看书';
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby     | qq        | phone       | age  | class | num  |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 |   20 | P2016 |    2 |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)


mysql> select * from stu where age is null;
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架  | 110112114 | 18925142345 | NULL | P2016 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where age is  not null;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select name,if(age>20,'成年','未成年') as chenqian  from stu;
+--------+----------+
| name   | chenqian |
+--------+----------+
| 何子健 | 未成年   |
| 何子健 | 未成年   |
| 邓声明 | 未成年   |
| 黄镇江 | 成年     |
| 郑晓晓 | 成年     |
+--------+----------+
5 rows in set (0.00 sec)

mysql> select * from stu;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
5 rows in set (0.00 sec)

mysql> select name,ifnull(age,'88') age_num from stu;
+--------+---------+
| name   | age_num |
+--------+---------+
| 何子健 | 88      |
| 何子健 | 20      |
| 邓声明 | 15      |
| 黄镇江 | 25      |
| 郑晓晓 | 30      |
+--------+---------+
5 rows in set (0.28 sec)


mysql> select * from stu where age is null;
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架  | 110112114 | 18925142345 | NULL | P2016 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where age is  not null;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
4 rows in set (0.00 sec)

mysql> select name,if(age>20,'成年','未成年') as chenqian  from stu;
+--------+----------+
| name   | chenqian |
+--------+----------+
| 何子健 | 未成年   |
| 何子健 | 未成年   |
| 邓声明 | 未成年   |
| 黄镇江 | 成年     |
| 郑晓晓 | 成年     |
+--------+----------+
5 rows in set (0.00 sec)

mysql> select * from stu;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
5 rows in set (0.00 sec)

mysql> select name,ifnull(age,'88') age_num from stu;
+--------+---------+
| name   | age_num |
+--------+---------+
| 何子健 | 88      |
| 何子健 | 20      |
| 邓声明 | 15      |
| 黄镇江 | 25      |
| 郑晓晓 | 30      |
+--------+---------+
5 rows in set (0.28 sec)


mysql> select * from stu limit 3;
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby     | qq        | phone       | age  | class | num  |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架      | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏      | 110112114 | 18925142345 |   15 | P2015 |    1 |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu limit 2;
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby     | qq        | phone       | age  | class | num  |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架      | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 |   20 | P2016 |    2 |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
2 rows in set (0.00 sec)

mysql> select * from stu limit 1;
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架  | 110112114 | 18925142345 | NULL | P2016 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu order by age desc limit 1;
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  5 | 郑晓晓 | 女  | 看书  | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where sex='男' limit 1;
+----+--------+-----+-------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby | qq        | phone       | age  | class | num  |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架  | 110112114 | 18925142345 | NULL | P2016 |    1 |
+----+--------+-----+-------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)
mysql> select * from stu where age between 20 and 40 ;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)

mysql> select * from stu where age in(20,25);
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
2 rows in set (0.00 sec)

mysql> select * from stu where age=20 or age=25;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
2 rows in set (0.01 sec)


mysql> select * from stu where name like '江';
Empty set (0.00 sec)

mysql> select * from stu where name like '%江';
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
1 row in set (0.00 sec)

mysql> select * from stu where name like '%子';
Empty set (0.00 sec)

mysql> select * from stu where name like '%子%';
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby     | qq        | phone       | age  | class | num  |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男  | 打架      | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男  | 游戏,看书 | 110112114 | 18925142345 |   20 | P2016 |    2 |
+----+--------+-----+-----------+-----------+-------------+------+-------+------+
2 rows in set (0.00 sec)

mysql> select * from stu where name ont like '%子%';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'ont like '%子%'' at line 1
mysql> select * from stu where name not like '%子%';
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
3 rows in set (0.00 sec)


mysql> select left(name,2) from stu;
+--------------+
| left(name,2) |
+--------------+
| 何子         |
| 何子         |
| 邓声         |
| 黄镇         |
| 郑晓         |
+--------------+
5 rows in set (0.00 sec)

mysql> select right(name,2) from stu;
+---------------+
| right(name,2) |
+---------------+
| 子健          |
| 子健          |
| 声明          |
| 镇江          |
| 晓晓          |
+---------------+
5 rows in set (0.00 sec)

mysql> select mid(name,2,2) from stu;
+---------------+
| mid(name,2,2) |
+---------------+
| 子健          |
| 子健          |
| 声明          |
| 镇江          |
| 晓晓          |
+---------------+
5 rows in set (0.01 sec)

mysql> select mid(name,1,2) from stu;
+---------------+
| mid(name,1,2) |
+---------------+
| 何子          |
| 何子          |
| 邓声          |
| 黄镇          |
| 郑晓          |
+---------------+
5 rows in set (0.00 sec)

mysql> select mid(name,3,2) from stu;
+---------------+
| mid(name,3,2) |
+---------------+
| 健            |
| 健            |
| 明            |
| 江            |
| 晓            |
+---------------+
5 rows in set (0.00 sec)




mysql> insert into stu (name,age,qq) value('马志斌','15','123123');
Query OK, 1 row affected (0.06 sec)

mysql> select * from stu;
+----+--------+------+----------------+-----------+-------------+------+-------+------+
| id | name   | sex  | hobby          | qq        | phone       | age  | class | num  |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男   | 打架           | 110112114 | 18925142345 | NULL | P2016 |    1 |
|  2 | 何子健 | 男   | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男   | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男   | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女   | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
|  6 | 马志斌 | 保密 | 游戏,看书      |    123123 | NULL        |   15 | NULL  | NULL |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
6 rows in set (0.00 sec)

mysql> update stu set age=28 where id=1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from stu;
+----+--------+------+----------------+-----------+-------------+------+-------+------+
| id | name   | sex  | hobby          | qq        | phone       | age  | class | num  |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 男   | 打架           | 110112114 | 18925142345 |   28 | P2016 |    1 |
|  2 | 何子健 | 男   | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男   | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男   | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女   | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
|  6 | 马志斌 | 保密 | 游戏,看书      |    123123 | NULL        |   15 | NULL  | NULL |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
6 rows in set (0.00 sec)

mysql> update stu set age=28,sex='女' where id=1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from stu;
+----+--------+------+----------------+-----------+-------------+------+-------+------+
| id | name   | sex  | hobby          | qq        | phone       | age  | class | num  |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
|  1 | 何子健 | 女   | 打架           | 110112114 | 18925142345 |   28 | P2016 |    1 |
|  2 | 何子健 | 男   | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男   | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男   | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女   | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
|  6 | 马志斌 | 保密 | 游戏,看书      |    123123 | NULL        |   15 | NULL  | NULL |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
6 rows in set (0.00 sec)

mysql> delete from stu where id =1;
Query OK, 1 row affected (0.09 sec)

mysql> select * from stu;
+----+--------+------+----------------+-----------+-------------+------+-------+------+
| id | name   | sex  | hobby          | qq        | phone       | age  | class | num  |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男   | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男   | 游戏           | 110112114 | 18925142345 |   15 | P2015 |    1 |
|  4 | 黄镇江 | 男   | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女   | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
|  6 | 马志斌 | 保密 | 游戏,看书      |    123123 | NULL        |   15 | NULL  | NULL |
+----+--------+------+----------------+-----------+-------------+------+-------+------+
5 rows in set (0.00 sec)




mysql> update stu set age = age+1 where age<20;
Query OK, 2 rows affected (0.08 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from stu;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   16 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  5 | 郑晓晓 | 女  | 看书           | 110112114 | 18925142345 |   30 | P2016 |    3 |
|  9 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | NULL  | NULL |
| 10 | 邓声明 | 男  | 游戏,看书      | 110112114 | 18925142345 |   16 | NULL  | NULL |
| 11 | 黄镇江 | 男  | 游戏,看书      | 110112114 | 18925142345 |   25 | NULL  | NULL |
| 12 | 郑晓晓 | 女  | 游戏,看书      | 110112114 | 18925142345 |   30 | NULL  | NULL |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
8 rows in set (0.01 sec)

mysql> delete from stu order by age desc limit 1;
Query OK, 1 row affected (0.07 sec)

mysql> select * from stu;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   16 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  9 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | NULL  | NULL |
| 10 | 邓声明 | 男  | 游戏,看书      | 110112114 | 18925142345 |   16 | NULL  | NULL |
| 11 | 黄镇江 | 男  | 游戏,看书      | 110112114 | 18925142345 |   25 | NULL  | NULL |
| 12 | 郑晓晓 | 女  | 游戏,看书      | 110112114 | 18925142345 |   30 | NULL  | NULL |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
7 rows in set (0.00 sec)

mysql> delete from stu order by age desc limit 1;
Query OK, 1 row affected (0.06 sec)

mysql> select * from stu;
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
| id | name   | sex | hobby          | qq        | phone       | age  | class | num  |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
|  2 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | P2016 |    2 |
|  3 | 邓声明 | 男  | 游戏           | 110112114 | 18925142345 |   16 | P2015 |    1 |
|  4 | 黄镇江 | 男  | 打架,游戏,看书 | 110112114 | 18925142345 |   25 | P2015 |    2 |
|  9 | 何子健 | 男  | 游戏,看书      | 110112114 | 18925142345 |   20 | NULL  | NULL |
| 10 | 邓声明 | 男  | 游戏,看书      | 110112114 | 18925142345 |   16 | NULL  | NULL |
| 11 | 黄镇江 | 男  | 游戏,看书      | 110112114 | 18925142345 |   25 | NULL  | NULL |
+----+--------+-----+----------------+-----------+-------------+------+-------+------+
6 rows in set (0.00 sec)

mysql>


alert()

alter

